package com.jds.apps.hr.employee.form;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.jds.apps.hr.employee.form.ext.AbstractEmployeeSearchFrom;


/**
 * 
 */
public class EmployeeSearchForm extends AbstractEmployeeSearchFrom {

    private List employees;
    private boolean searchMode;
    private String messageKey;
        
    public ActionErrors validate(ActionMapping mapping, 
            HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        
//      TODO Implement validation
        
        return errors;
     }

    /**
     * @return Returns the employees.
     */
    public List getEmployees() {
        return employees;
    }
    
    /**
     * @param employees The employees to set.
     */
    public void setEmployees(List employees) {
        this.employees = employees;
    }

    /**
     * @return Returns the hasResult.
     */
    public int getListSize() {
        if(employees == null){
            return -1;
        }
        
        return employees.size();
    }

    /**
     * @return Returns the hasResult.
     */
    public String getRecordCount() {
        return Integer.toString(getListSize());
    }

    /**
     * @return Returns the searchMode.
     */
    public boolean isSearchMode() {
        return searchMode;
    }
    
    /**
     * @param searchMode The searchMode to set.
     */
    public void setSearchMode(boolean searchMode) {
        this.searchMode = searchMode;
    }
    
    /**
     * @return Returns the messageKey.
     */
    public String getMessageKey() {
        
        if(0 == getListSize()){
            return "search.zeroresult";
        } else {
            return "search.resultcount";
        }
    }
        
}
